//中病西病详情 格式化************************************************************************
export default function (data) {
	var array = [];
	for (var key in data) {
		if (array.length == 0) {
			var obj = {
				title1: key.split("#")[0],
				arr: [],
			};
			var obj2 = {
				con: data[key],
				infoKey: key.split("#")[2],
				title2: key.split("#")[1],
			};
			var reg = new RegExp("\\\\n", "g");
			var str = new RegExp("\r\n", "g");
			var str2 = new RegExp("&ldquo;", "g");
			var str3 = new RegExp("&rdquo;", "g");
			obj2.con = obj2.con.replace(reg, "\n");
			obj2.con = obj2.con.replace(str, "");
			obj2.con = obj2.con.replace(str2, "“");
			obj2.con = obj2.con.replace(str3, "”");
			obj2.con = obj2.con.replace(/\\t/g, "\t");
			obj.arr.push(obj2);
			array.push(obj);
		} else {
			for (var i = 0; i < array.length; i++) {
				if (key.split("#")[0] == array[i].title1) {
					var obj2 = {
						title2: key.split("#")[1],
						infoKey: key.split("#")[2],
						con: data[key],
					};
					var reg = new RegExp("\\\\n", "g");
					var str = new RegExp("\r\n", "g");
					var str2 = new RegExp("&ldquo;", "g");
					var str3 = new RegExp("&rdquo;", "g");
					obj2.con = obj2.con.replace(reg, "\n");
					obj2.con = obj2.con.replace(str, "");
					obj2.con = obj2.con.replace(str2, "“");
					obj2.con = obj2.con.replace(str3, "”");
					obj2.con = obj2.con.replace(/\\t/g, "\t");
					array[i].arr.push(obj2);
					break;
				} else {
					if (i == array.length - 1) {
						var obj = {
							title1: key.split("#")[0],
							arr: [],
						};
						var obj2 = {
							title2: key.split("#")[1],
							infoKey: key.split("#")[2],
							con: data[key],
						};
						var reg = new RegExp("\\\\n", "g");
						var str = new RegExp("\r\n", "g");
						var str2 = new RegExp("&ldquo;", "g");
						var str3 = new RegExp("&rdquo;", "g");
						obj2.con = obj2.con.replace(reg, "\n");
						obj2.con = obj2.con.replace(str, "");
						obj2.con = obj2.con.replace(str2, "“");
						obj2.con = obj2.con.replace(str3, "”");
						obj2.con = obj2.con.replace(/\\t/g, "\t");
						obj.arr.push(obj2);
						array.push(obj);
						break;
					}
				}
			}
		}
	}
	return array;
}
